public class Test3 {
    static int func(String s){
       int[] count=new int[26];
        for (int i = 0; i < s.length(); i++) {
            char ch=s.charAt(i);
            count[ch-'a']++;
        }
        for (int i = 0; i < s.length(); i++) {
            char ch=s.charAt(i);
            if(count[ch-'a']==1){
                return i;
            }
        }
        return -1;
    }

    public static void main1(String[] args) {
        String s="aabbcd";
        System.out.println(func(s));
    }

    public static void main2(String[] args) {
        String s="aabbaa";
        System.out.println(isPalindrome(s));
    }
    public static boolean isPalindrome(String s) {
        s=s.toLowerCase();
        int left=0;
        int right=s.length()-1;
        while(left<right){
            while(left<right&&!isbright(s.charAt(left))){
                left++;
            }
            while(left<right&&!isbright(s.charAt(right))){
                right--;
            }
            if(s.charAt(left)==s.charAt(right)){
                left++;
                right--;
            }else {
                return false;
            }
        }
        return true;
    }
    public static boolean isbright(char a){
        if(Character.isDigit(a)||Character.isLetter(a)){
            return true;
        }else {
            return false;
        }
    }

    public static void main(String[] args) {
        StringBuilder stringBuilder=new StringBuilder();
        stringBuilder.append("hello");
        stringBuilder.append("world");
        System.out.println(stringBuilder);
        System.out.println(stringBuilder.reverse());
        System.out.println(stringBuilder.replace(0,3,"hello"));
        StringBuffer stringBuffer=new StringBuffer();
        stringBuffer.append("hello");
    }
}
